import Vue from 'vue'
import Router from 'vue-router'



Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect:'/home'
    },



    // {
    //   path: '/api/payment',
    //   name: 'payment',
    //   component: ()=> import('@/components/payment.vue')
    // },
    {
      path: '/goods',
      name: 'goods',
      component: ()=> import('@/components/goods.vue')
    },
    {
      path: '/buy/:storeId',
      name: 'buy',
      component: ()=> import('@/components/buy.vue')
    },
    {
      path: '/login',
      name: 'login',
      component: ()=> import('@/components/login.vue')
    },
    {
      path: '/register',
      name: 'register',
      component: ()=> import('@/components/register.vue')
    },
    {
      path: '/store/:id/:storeName',
      name: 'store',
      component: ()=> import('@/components/store.vue')
    },
    {
      path: '/dish/:id',
      name: 'dish',
      component: ()=> import('@/components/dish.vue')
    },
    {
      path: '/index',
      name: 'index',
      component: ()=> import('@/components/app_index.vue'),
      children: [
        { name: '首页', path: '/home', component: () => import('@/components/home.vue') },
        { name: '购物车', path: '/cart', component: () => import('@/components/cart.vue') },
        { name: '分类', path: '/sorts', component: () => import('@/components/sorts.vue') },
        { name: '个人中心', path: '/personCenter', component: () => import('@/components/person.vue') },
        { name: '收货地址', path: '/address', component: () => import('@/components/address.vue') },
        { name: '订单显示', path: '/order/', component: () => import('@/components/order.vue') },
        { name: '订单显示2', path: '/order2', component: () => import('@/components/order2.vue') },
        { name: '订单显示3', path: '/order3', component: () => import('@/components/order3.vue') },
        { name: '订单显示4', path: '/order4', component: () => import('@/components/order4.vue') },
        { name: '订单显示细节', path: '/orderDetail/:id', component: () => import('@/components/orderDetail.vue') },

      ]
    },
    {
      path:'/edit',
      name:'edit',
      component: ()=> import('@/components/edit.vue'),
    },
    {
      path:'/avator',
      name:'avator',
      component: ()=> import('@/components/avator.vue'),
    },
    {
      path:'/addAddress',
      name:'addAddress',
      component: ()=> import('@/components/addAddress.vue'),
    }


  ]
})
